package converters;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jdesktop.beansbinding.Converter;

public class DateConverter2  extends Converter<Date, String> {
    @Override
    public String convertForward(Date value) {
        return new SimpleDateFormat("dd/MM/yyyy").format(value);
    }

    @Override
    public Date convertReverse(String value) {
        try {
            return new SimpleDateFormat("dd/MM/yyyy").parse(value);
        } catch (ParseException ex) {
            return null;
        }
    }
    
}
